package share;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Constant {
	public static final long MINIMUM_TRANSFERED_AMOUNT = 5000000l;
	public static final String SESSION_ATR_LOGINID = "loginid";
	public static final String STR_TRUE = "true";
	public static final String STR_EMPTY = "";
	public static final String SESSION_ATR_LOGIN_FAIL = "loginfail";
	public static final String SESSION_ATR_CUSTOMER_ID = "customerid";
	public static final String VIEW_LOGIN = "login";
	public static final String VIEW_HOME = "home";
	public static final String VIEW_CUSTOMER_INFO = "customerinfo";
	public static final String VIEW_HISTORY = "history";
	public static final String VIEW_ADMIN = "admin";
	public static final String VIEW_ADMIN_LOGIN = "admin_login";
	public static final String VIEW_ADMIN_DETAIL = "admin_detail";
	public static final String VIEW_ADMIN_DETAIL_APPROVE = "admin_detail_approve";
	public static final String VIEW_ADMIN_LOG = "adminLog";
	public static final long MAXIMUM_TRANSFER_AMOUNT_PER_DAY = 30000000;
	public static final int MAXIMUM_TRANSFER_PER_DAY = 3;
	public static final String PARAM_LOGINID = "loginId";
	public static final String PARAM_PASSWORD = "password";
	public static final String PARAM_OPTION_CHOOSE_ACCOUNT = "optionChooseAccount";
	public static final String PARAM_VALUE_FROM_INPUT_ACCOUNT = "fromInputAccount";
	public static final String PARAM_VALUE_FROM_LIST_ACCOUNT = "fromListAccount";
	public static final String PARAM_AMOUNT = "amount";
	public static final String PARAM_OLDPASSWORD = "oldPassword";
	public static final String PARAM_NEW_PASSWORD = "newPassword";
	public static final String PARAM_TARGET_ACCOUNT_NUMBER = "targetAccountNumber";
	public static final String PARAM_DESCRIPTION = "description";
	public static final String PARAM_SELECT_TARGET_ACCOUNT_NUMBER = "selectTargetAccountNumber";
	public static final String PARAM_TRANSACTION_ID = "transactionId";
	public static final String PARAM_REASON = "reason";
	public static final String MODEL_OBJ_LOGIN_RESULT = "objLoginResult";
	public static final String MODEL_OBJ_CUSTOMER = "customer";
	public static final String MODEL_OBJ_MESSAGE = "message";
	public static final String MODEL_OBJ_CUSTOMER_LIST = "customerList";
	public static final String MODEL_OBJ_SENT_TRANSACTION = "transactionList";
	public static final String MODEL_OBJ_RECEIVED_TRANSACTION = "transactionList2";
	public static final String MODEL_OBJ_TRANSACTION_DETAIL = "transactionDetail";
	public static final String MODEL_OBJ_LOG_LIST = "logList";
	public static final String VIEW_CHANGE_PASSWORD = "changepassword";
	public static final String VIEW_MONEY_TRANSFER = "moneytransfer";
	public static final String MODEL_OBJ_NUMBER_OF_TRANSACTION = "numberOfTransaction";
	public static final String MODEL_OBJ_TRANSFERED_AMOUNT = "transferredAmount";
	public static final String SESSION_ATR_IS_CUSTOMER = "isCustomer";
	
	public static String getMD5Code(String src) {
		try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            byte[] messageDigest = md.digest(src.getBytes());
            BigInteger number = new BigInteger(1, messageDigest);
            String hashtext = number.toString(16);
            // Now we need to zero pad it if you actually want the full 32 chars.
            while (hashtext.length() < 32) {
                hashtext = "0" + hashtext;
            }
            return hashtext;
        }
        catch (NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        }
	}
}
